#ifndef _RUNNABLE_H
#define _RUNNABLE_H INC

class threaded {
	public:

	virtual void run(){
		/*noop*/
	}
};

void * run_runnable( void * t ) {
	threaded * obj = ( threaded * ) t;

	obj->run();

	void * ret = NULL;
	return ret;
}

class runnable : public threaded {
	public:

	pthread_t            * InternalThread;

	runnable() {
		this->InternalThread = new pthread_t;
	}

	virtual void start() {
		void * sp = NULL;
		pthread_create( this->InternalThread, NULL, run_runnable, this  );
	}
	virtual void wait() {
		pthread_join (  *this->InternalThread, NULL );
	}
	virtual void run() {
		std::cout << "Running\n";
	}
};

#endif
